package com.cn.crmsystem.controller.censusController;

import com.cn.crmsystem.pojo.ResultJson;
import com.cn.crmsystem.service.censusService.MailListService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
//from ldk
@Controller
@Api(value = "通讯录的数据",tags = "通讯录的数据接口api")
public class MailListController {
    @Autowired
    public MailListService mailListService;

    @RequestMapping(value = "/selectUserMail" ,method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "通讯录表格数据",notes = "展示通讯录表格的数据，展示name,phone,departmentName,roleName",
            httpMethod = "POST",
            response =ResultJson.class )
    public ResultJson selectUser(){

        return  mailListService.selectUser();
    }


    @RequestMapping(value = "/selectForIf" ,method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "按条件查询通讯录，条件是员工的姓名，手机号，或者是所属部门",notes = "展示通讯录表格的数据，展示" +
            "name(员工性名),phone(员工电话),departmentName(员工所在部门),roleName(员工所属职位)",
            httpMethod = "POST",
            response =ResultJson.class )
    @ApiImplicitParams({
            @ApiImplicitParam(name = "selectkuang",value = "员工性名/电话号码",paramType = "query",
                    dataType = "String",required =false)
    })
    public  ResultJson selectForIf(  @RequestParam(required = false) String selectkuang   ){

        return  mailListService.selectForIf(selectkuang);
    }

    @RequestMapping(value = "/selectDepartment" ,method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "渲染下拉框的部门",notes = "下拉框的所有部门名称",
            httpMethod = "POST",
            response =ResultJson.class )
    public ResultJson selectDepartment(){
        return mailListService.selectDepartment();
    }

}
